-- player:DoTaskInTime(0, function(inst)
-- 		local ground = GLOBAL.GetWorld()
-- 		for i=1,#ground.topology.nodes do
-- 			local bg = string.find( ground.topology.ids[i], ":BG_" )
-- 					or string.find( ground.topology.ids[i], ":BLOCKER_BLANK")
-- 			if not bg then
-- 				--print(">revealing",ground.topology.ids[i])
-- 				local cent = ground.topology.nodes[i].cent
-- 				ground.minimap.MiniMap:ShowArea(cent[1], 0, cent[2], 95)
-- 			else
-- 				--print("<ignoring",ground.topology.ids[i])
-- 			end
-- 		end
-- 	end)

local SIZE = 50
local function ongameload(inst)
	for i,v in ipairs(inst.topology.nodes) do
		if v.type == "START" then
			local minimap = inst.minimap.MiniMap
			local map = inst.Map 
			for Z = -SIZE/2, SIZE/2 do
				for X = -SIZE/2, SIZE/2 do
					local x, z = X*4 + v.x, Z*4 + v.y
					local cx, cy, cz = map:GetTileCenterPoint(x, 0, z)
					local tx, ty = map:GetTileCoordsAtPoint(x, 0, z)
					local actual_tile = map:GetTile(tx, ty)
					if actual_tile ~= nil and actual_tile ~= GROUND.IMPASSABLE then
						minimap:ShowArea(cx, cy, cz, 32)
					end
				end
			end

			break
		end
	end
end

return Prefab("rg_start", function()
	local inst = SpawnPrefab("rg_baseworld")
	
	inst.prefab = "rg_start"

	inst:RG_AddWaveComponent{
		RegionSize = {13.5, 2.5},
		WaveSize = {80, 3.5}, 
		WaveTexture = "images/wave.tex",
		WaveEffect = "shaders/waves.ksh",
	}

	inst.components.rg_maprevealer:AddGameLoadFn(ongameload)
end)